# @s - 上一层对应的 mt_gen

# 微调生成方向
function mountain:gen/common/rnd/random
execute if score result mt_random matches 0..2 run tp @s ~ ~ ~ ~-30 0
execute if score result mt_random matches 3..5 run tp @s ~ ~ ~ ~-15 0
execute if score result mt_random matches 6..8 run tp @s ~ ~ ~ ~15 0
execute if score result mt_random matches 9..11 run tp @s ~ ~ ~ ~30 0

# 调用生成函数
function mountain:gen/common/rnd/random
execute if score cur mt_layer matches 1..4 if score @s mt_gen_type matches 0 run function mountain:gen/common/summon_toward/s1
execute if score cur mt_layer matches 1..4 if score @s mt_gen_type matches 1 run function mountain:gen/common/summon_toward/l1
execute if score cur mt_layer matches 5.. if score @s mt_gen_type matches 0 run function mountain:gen/common/summon_toward/s2
execute if score cur mt_layer matches 5.. if score @s mt_gen_type matches 1 run function mountain:gen/common/summon_toward/l2

# 调整新盔甲架方向
tag @s add mt_gen_cur_origin
execute as @e[tag=mt_gen_new,limit=1] run execute at @s run tp @s ~ ~ ~ facing entity @e[tag=mt_gen_cur_origin,limit=1] eyes
execute as @e[tag=mt_gen_new,limit=1] run execute at @s run tp @s ~ ~ ~ ~180 0
tag @s remove mt_gen_cur_origin

# 计分板属性
scoreboard players operation @e[tag=mt_gen_new,limit=1] mt_gen_type = @s mt_gen_type
# 计分板属性
scoreboard players operation @e[tag=mt_gen_new,limit=1] mt_index = @s mt_index

# 取消 tag
tag @e[tag=mt_gen_new,limit=1] remove mt_gen_new